// import { request } from "http"

require(['./config'], () => {
    require(['request', 'template', 'header', 'footer','dropdown'], (request, template) => {
        class Cate {
            constructor() {
                this.init()
                this.dropdown()
            }

            init() {
                // 从url上取到id
                const id = window.location.hash.slice(1)
                console.log(id)
                request.getCategory(id).then(resp => {
                    // console.log(resp)
                    if (resp.code === 200) {
                        const { name } = resp.data.category
                        const { list } = resp.data.item
                        $('.content').html(template('cateTemplate', { name, list }))
                    }

                })
            }

            dropdown() {
                
            }
        }
        new Cate()
    })
})